<?php

$num_columns	= 4;
$can_delete	= $this->auth->has_permission('Category.Content.Delete');
$can_edit		= $this->auth->has_permission('Category.Content.Edit');
$has_records	= isset($records) && is_array($records) && count($records);

if ($can_delete) {
    $num_columns++;
}
?>
<section class="content-header">
  <h1>
    <?php echo lang('category_area_title'); ?>管理
    <!-- <small>advanced tables</small> -->
  </h1>
  <!-- <ol class="breadcrumb">
    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
    <li><a href="#">Tables</a></li>
    <li class="active">Data tables</li>
  </ol> -->
</section>

<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-xs-12">
      <div class="box box-primary">
	    <?php echo form_open($this->uri->uri_string()); ?>
        <div class="box-header">
          <h3 class="box-title"><?php echo lang('category_area_title'); ?></h3>
          <div class="box-tools pull-right">
                <!-- <div class="pull-right" style="margin-bottom:10px"> -->
                	
                	<a href="/<?php echo SITE_AREA . '/content/category/create'; ?>"  class="btn btn-block btn-primary">新增</a>
                <!-- </div> -->
          </div>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
          <table id="example2" class="table table-striped table-bordered table-hover">
            <thead>
            <tr>
            <?php if ($can_delete) : ?>
            	<th class='column-check'><input class='check-all' type='checkbox' /></th>
            <?php endif;?>
              <!-- <th>ID</th> -->
              <th>标签</th>
              <th>URI别名</th>
               <th>启用</th>
              <th>操作</th>
            </tr>
            </thead>
            <tbody>
            	<?php
				if ($has_records) :
					foreach ($records as $record) :
				?>
				<tr>
					<?php if ($can_delete) : ?>
					<td class='column-check'><input type='checkbox' name='checked[]' value='<?php echo $record->tag_id; ?>' /></td>
					<?php endif;?>

					<!-- <td><?php //e($record->tag_id); ?></td> -->
					<td><?php e($record->tag_name); ?></td>
					<td><?php e($record->url_str); ?></td>
                                    <?php if($record->status==1): ?>
                                         <td><span class='label label-success'>已启用</span></td> 
                                   <?php else : ?>
                                          <td><span class='label label-default'>未启用</span></td> 
                                   <?php endif; ?> 
					<?php if ($can_edit) : ?>
						<td><a href="/<?php echo SITE_AREA . '/content/category/edit/' . $record->tag_id; ?>" class="btn btn-xs btn-primary"><i class="fa fa-pencil" data-toggle="tooltip" data-placement="top" title="" data-original-title="Edit"></i></a>

						
						<a href="/<?php echo SITE_AREA . '/content/category/delete/' . $record->tag_id; ?>" class="btn btn-xs btn-danger" style="cursor:pointer;" onclick="return confirm('确定删除吗?');"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="" data-original-title="Delete"></i></a>

						</td>
					<?php else : ?>
						<td></td>
					<?php endif; ?>
				</tr>
				<?php
					endforeach;
				else:
				?>
				<tr>
					<td colspan='<?php echo $num_columns; ?>'><?php echo lang('category_records_empty'); ?></td>
				</tr>
				<?php endif; ?>
          </table>
        </div>
        <!-- /.box-body -->
        
	    <div class="box-footer">
		    <div class="pull-left">
		    	选择之后：
		    	<button type="submit" name='delete' class="btn btn-danger" onclick="return confirm('确定删除吗?');"><?php echo lang('bf_action_delete'); ?></button>
	        </div>
	        <div class="pull-right">
	        	<?php echo $this->pagination->create_links(); ?>
	        </div>
          </div>
        <?php
	    	echo form_close();
	       	// echo $this->pagination->create_links(); 
	    ?>
      </div>
      <!-- /.box -->
    </div>
    <!-- /.col -->
  </div>

</section>
